<?php
// +----------------------------------------------------------------------
// | CoreThink [ Simple Efficient Excellent ]
// +----------------------------------------------------------------------
// | Copyright (c) 2014 http://www.corethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: jry <598821125@qq.com> <http://www.corethink.cn>
// +----------------------------------------------------------------------
namespace Manual\Model;
use Think\Model;
/**
 * 应用模型
 * @author jry <598821125@qq.com>
 */
class ManualModel extends Model{
    /**
     * 自动验证规则
     * @author jry <598821125@qq.com>
     */
    protected $_validate = array(
        array('title','require','请填写手册名称', self::MUST_VALIDATE, 'regex', self::MODEL_BOTH),
        array('cover','require','请上传封面图片', self::MUST_VALIDATE, 'regex', self::MODEL_BOTH),
        array('abstract','require','请填写描述', self::MUST_VALIDATE, 'regex', self::MODEL_BOTH),
        array('content','require','请填写详情', self::MUST_VALIDATE, 'regex', self::MODEL_BOTH),
        array('version','require','请填写版本', self::MUST_VALIDATE, 'regex', self::MODEL_BOTH),
        array('title', '', '手册名称已存在', self::MUST_VALIDATE, 'unique', self::MODEL_BOTH),
    );

    /**
     * 自动完成规则
     * @author jry <598821125@qq.com>
     */
    protected $_auto = array(
        array('uid', 'is_login', self::MODEL_INSERT, 'function'),
        array('ctime', NOW_TIME, self::MODEL_INSERT),
        array('utime', NOW_TIME, self::MODEL_BOTH),
        array('sort', '0', self::MODEL_INSERT),
        array('status', '1', self::MODEL_INSERT),
    );
}
